package team.you.change.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import team.you.change.pojo.College;
import team.you.change.util.Result;
import team.you.change.service.CollegeService;

@Controller
@RequestMapping("/college")
public class CollegeController {
    @Autowired
    private CollegeService collegeService;

    @RequestMapping("/getAllColleges")
    @ResponseBody
    private Result getAllColleges(Integer page, Integer limit)
    {
        return collegeService.getAllColleges(page,limit);
    }
    @RequestMapping("/getAllCollegeId")
    @ResponseBody
    private Result getAllCollegeId(){
        return collegeService.getAllCollegeId();
    }
    @RequestMapping("/add")
    @ResponseBody
    private Result add(String name, Integer type, Integer college){
        return collegeService.add(name, type, college == null ? 0:college);
    }
    @RequestMapping("/getAllPId")
    @ResponseBody
    private Result getAllPId(){
        return collegeService.getAllPId();
    }
    @RequestMapping("/del")
    @ResponseBody
    private Result del(Integer id){
        return collegeService.del(id);
    }
    @RequestMapping("/delete")
    @ResponseBody
    private Result delete(String[] ids)
    {
        return collegeService.delete(ids);
    }
    @RequestMapping("/update")
    @ResponseBody
    private Result update(College college)
    {
        return collegeService.update(college);
    }
    @RequestMapping("/selectByLike")
    @ResponseBody
    private Result selectByLike(String value,Integer type,Integer page,Integer limit) {
        return collegeService.selectByLike(value,type,page,limit);
    }
    @RequestMapping("/getCollegeOption")
    @ResponseBody
    private Result getCollegeOption(){
        return collegeService.getCollegeOption();
    }
    @RequestMapping("/getMajorOption")
    @ResponseBody
    private Result getMajorOption(Integer id){
        return collegeService.getMajorOption(id);
    }
}
